/**
 * 점수관리를 위한 스크립트
 * date : 2014.11.3 
 * 작성자 : kyun
 */

//var btnlist, btninput, btnview, btnmodify, btndelete;

function general()
{
	
	btnlist=document.getElementById('btnlist');
	if(btnlist!=null)
	{
		btnlist.onclick=function()
		{
			var frm=document.hiddenFrm;
			frm.action='../3jsp/list.jsp';
			frm.submit();
		}
	}
	//사용됨
	btninput=document.getElementById('btninput');
	if(btninput!=null)
	{
		btninput.onclick=function()
		{
			var frm=document.hiddenFrm;
			frm.action='../3jsp/input.jsp';
			frm.submit();
			//location.href=url+'input.jsp';
		}
	}
	//사용됨
	btnminput=document.getElementById('btnminput');
	if(btnminput!=null)
	{
		btnminput.onclick=function()
		{
			var frm=document.hiddenFrm;
			frm.action='../3jsp/masterinput.jsp';
			frm.submit();
			//location.href=url+'input.jsp';
		}
	}
	btnview=document.getElementById('btnview');
	if(btnview!=null)
	{
		btnview.onclick=function()
		{
			location.href='../3jsp/view.jsp';
		}
	}
	btnmodify=document.getElementById('btnmodify');
	if(btnmodify!=null)
	{
		btnmodify.onclick=function()
		{
			location.href='../3jsp/modify.jsp';
		}
	}
	btndelete=document.getElementById('btndelete');
	if(btndelete!=null)
	{
		btndelete.onclick=function()
		{
			var b = confirm("정말 ?!!");
			if(b)
			{
				var rno=document.hiddenFrm.rno.value;
				location.href='../3jsp/delete_result.jsp&rno='+rno;
			}
			else
			{
				alert("그래~ 삭제하지마..ㅋㅋ");
			}
		}
	}
}
//사용됨
function saveda()
{
	btnsave=document.getElementById('btnsave');
	if(btnsave!=null)
	{
		btnsave.onclick=function()
		{
			var f= document.hiddenFrm;
			if(f.pwd.value=='')
			{
				alert('비밀번호 입력해주세요');
				f.pwd.focus();
			}
			else
			{
				
				f.action='../3jsp/input_result.jsp'
				f.submit();
			}
		}
	}
}
//사용됨
function msaveda()
{
	btnmsave=document.getElementById('btnmsave');
	if(btnmsave!=null)
	{
		btnmsave.onclick=function()
		{
			
					
			var f= document.hiddenFrm;
		
			f.action='../3jsp/masterinput_result.jsp'
			f.submit();
			
		}
	}
}
function goPage(page){
	var mf = document.hiddenFrm;
	mf.nowPage.value = page;
	mf.find.value = document.master_list_frm.find.value;
	mf.action = 'list.jsp';
	mf.submit();
	//alert(page);
	//location.href=url + 'view.jsp&page=' + page;
}
function goview(page, rno)
{
	var mf = document.hiddenfrm;
	mf.nowPage.value = page;
	mf.rno.value=rno;
	mf.find.value = document.score_list_frm.find.value;
	mf.action = 'index.jsp?inc=../score/view.jsp';
	mf.submit();
}
function deleteinit()
{
	general();
}
//사용됨
function inputinit()
{
	btnlist=document.getElementById('btnlist');
	if(btnlist!=null)
	{
		btnlist.onclick=function()
		{
			var frm=document.hiddenFrm;
			frm.action='../3jsp/list.jsp';
			alert("입력을 취소하시겠습니다?"+"\n"+"작성된 글은 지워집니다.")
			frm.submit();
		}
	}
	saveda();
	msaveda();
}
//사용됨
function listinit()
{
	general();
}
function modifyinit()
{
	btnlist=document.getElementById('btnlist');
	if(btnlist!=null)
	{
		btnlist.onclick=function()
		{
			var frm=document.hiddenFrm;
			frm.action='../3jsp/list.jsp';
			alert("수정을 취소하시겠습니다?"+"\n"+"변경된 내용은 지워집니다.")
			frm.submit();
		}
	}
	saveda();
}
function viewinit()
{
	general();
}
